package com.zhss.designpattern.factory;

public class FactoryPatternDemo {

    public interface Product{
        public void execute();
    }

    public static class ProductImpl implements Product{
        public void execute() {
            System.out.println("------- 执行生产功能！！！！！");
        }
    }

    public static class ProductFactory{
        private static Product product;

        public static Product create(){
            if (product == null){
                return new ProductImpl();
            }
            return product;
        }
    }

    public static void main(String[] args) {
        Product product = ProductFactory.create();
        product.execute();
    }
}
